from selenium.webdriver.common.by import By
from base.base_page import BasePage, BaseOperate
from utils import select_box, UtilsDriver


# 页面对象层
class EmailListPage(BasePage):
	def __init__(self):
		self.search = By.XPATH, "//*[@class='searchbox']/div[1]//input"
		self.email = By.XPATH, "//*[@class='searchbox']/div[1]//input"
		self.phone = By.XPATH, "//*[@class='searchbox']/div[1]//input"
		self.age = By.XPATH, "//*[@class='searchbox']/div[1]//input"

	def find_search(self):
		return self.get_element(self.search)

	def find_email(self):
		return self.get_element(self.email)

	def find_phone(self):
		return self.get_element(self.phone)

	def find_age(self):
		return self.get_element(self.age)


# 页面操作层
class EmailListOperate(BaseOperate):
	def __init__(self):
		self.operate_obj = EmailListPage()

	def click_search(self):
		self.operate_obj.find_search().click()

	def input_email(self, email):
		self.input_text(self.operate_obj.find_email(), email)

	def input_phone(self, phone):
		select_box(UtilsDriver.get_web_driver(), self.operate_obj.find_phone(), phone)

	def get_age_text(self):
		return self.operate_obj.find_age().text